<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>View Reservations</title>
</head>
<body>
<jsp:include page="Layout/header.jsp"/>
<h1>View your reservations:</h1>
<h3>still needed:</h3>
  <s:form action="deleteReservation(String)" >
    <s:submit value="Cancel" />
  </s:form>

<p>If we are having a login then user will be saved in the database and a list of all reservations in the
future should pull up, if not we will 
need them to enter their information then link to a page with all their reservations
in a list. the reservations could be selectable so they can choose one to view in greater detail and 
maybe give them the option to cancel or view past reservations. viewing past reservations will need
a date range option or show all. It would be nice to have the options pull up on the same page rather than redirecting when they
select "View past reservations" </p>
  <% java.util.Date d = new java.util.Date();
  d.setMonth(d.getYear() + 1);
  String[][] result = new reservation.QueryRunner().getUserReservesWithin("", d.toString(),session.getAttribute("currentUserID"));
  String tempy = result;
  String tempx = tempy.split(" ", 1)[0];
  %><table> <%

  for(int row = 0; row < result.length; row++)
  {
	 %> <tr> <%
	 for(int column = 0; column < result[row].length; column++)
	 {
		 %> <td> <%=result[row][column] %> </td> <%
	 }
	 %>
  <s:form action="QueryRunner" >
    <s:hidden value="<%=result[row][0] %>" />
    <s:submit value="Cancel" />
  </s:form>
	 </tr><%
	 
  }
  %> </table>
  
  <s:form action="/main.jsp" >
    <s:submit value="Back" />
  </s:form>
<jsp:include page="Layout/footer.jsp"/>
</body>
</html>